/**
 * 队列任务
 */
export default class TaskQueue {
	taskJob: Array<Function>;
	constructor() {
		this.taskJob = [];
	}
	addJob(job: Function) {
		if (typeof job !== "function") {
			console.error("传入的[job]必须是一个函数");
			return;
		}
		console.log("加入");
		this.taskJob.push(job);
	}
	executeQueue() {
		while (this.taskJob.length > 0) {
			console.log("执行队列");
			const job = this.taskJob.shift();
			job && job();
		}
	}
}
